<%@page pageEncoding="ISO-8859-1"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="t" uri="http://myfaces.apache.org/tomahawk"%>

<%@taglib prefix="a4j" uri="http://richfaces.org/a4j"%>
<%@taglib prefix="rich" uri="http://richfaces.org/rich"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<%
        request.setAttribute("nombrePagina", "Buscar Solicitud de Credito");
%>

<f:view>
    <%@include file="/WEB-INF/jspf/header.jspf" %>
    <%@include file="/WEB-INF/jspf/breadcumbs.jspf" %>
    <%@include file="/WEB-INF/jspf/options.jspf" %>

    <rich:panel>
        <h1><h:outputText value="Buscar Solicitud de Credito" /></h1>
        <h:form>
            <h:messages showDetail="true" />
           <fieldset>
                <legend>Datos del Cliente</legend>
                <h:panelGrid columns="2" cellpadding="2" cellspacing="2">
                    <h:panelGrid columns="2" cellpadding="1" cellspacing="1" rendered="#{SolicitudCreditoController.identificador==1}">
                        <h:outputLabel value="<b>DNI:</b>" for="txtDni" escape="false" />
                        <h:inputText id="txtDni" size="8" maxlength="8" value="#{SolicitudCreditoController.clienteNatural.dniPersona}"/>
                    </h:panelGrid>
                    <h:panelGrid columns="2" cellpadding="1" cellspacing="1" rendered="#{SolicitudCreditoController.identificador==2}">
                        <h:outputLabel value="<b>RUC:</b>" for="txtRUC" escape="false" />
                        <h:inputText id="txtRUC" size="11" maxlength="11" value="#{SolicitudCreditoController.clienteJuridico.ruc}"/>
                    </h:panelGrid>
                    <h:selectOneRadio id="rbnIdentificador" onchange="submit()" value="#{SolicitudCreditoController.identificador}">
                        <f:selectItem itemValue="1" itemLabel="Natural"/>
                        <f:selectItem itemValue="2" itemLabel="Juridico"/>
                    </h:selectOneRadio>

                    <h:commandButton id="btnBuscar" value="Buscar" styleClass="negrita" action="#{SolicitudCreditoController.buscarSolicitud}" />
                    <h:commandButton id="btnRegCliente" value="Registrar Cliente" styleClass="negrita" action="submit()"/>
                </h:panelGrid>
                <h:panelGrid columns="2" cellpadding="1" cellspacing="1" rendered="#{SolicitudCreditoController.identificador==1}">
                    <h:outputLabel value="<b>Nombre:</b>" for="txtNombreCliente"  escape="false" />
                    <h:outputText id="txtNombreCliente" value="#{SolicitudCreditoController.clienteNatural.nombrePersona} #{SolicitudCreditoController.clienteNatural.apePaternoPersona} #{SolicitudCreditoController.clienteNatural.apeMaternoPersona}" />
                </h:panelGrid>
                <h:panelGrid columns="2" cellpadding="1" cellspacing="1" rendered="#{SolicitudCreditoController.identificador==2}">
                    <h:outputLabel value="<b>Razon Social:</b>" for="txtRazonSocial"  escape="false" />
                    <h:outputText id="txtRazonSocial" value="#{SolicitudCreditoController.clienteJuridico.razonSocial}" />
                </h:panelGrid>
                <h:panelGrid columns="2">

                </h:panelGrid>
            </fieldset>

            <br>

            <h:outputText value="<h3>Datos Credito:</h3>" escape="false" />

            <h:panelGrid columns="1" rendered="#{SolicitudCreditoController.solicitudCredito != null}">
                <%@include file="/WEB-INF/datosModulo/datosSolicitudCredito.jspf" %>
                <h:commandButton id="btnModificar" value="Continuar con el Tramite" action="#{SolicitudCreditoController.tramitar}" styleClass="negrita" />
            </h:panelGrid>

            <br>
            <br>
            <h:commandButton id="btncancelar" value="Cancelar" action="volver" styleClass="negrita" />

        </h:form>
    </rich:panel>
    <%@include file="/WEB-INF/jspf/footer.jspf" %>
</f:view>